<#assign dbTime = "now()">
<#if dbType=="SQLServer">
    <#assign dbTime = "getDate()">
</#if>

-- 初始化菜单
INSERT INTO sys_menu (
menu_name,
parent_id,
order_num,
path,
component,
is_frame,
is_cache,
menu_type,
visible,
STATUS,
perms,
icon,
create_by,
create_time,
update_by,
update_time,
remark
)
VALUES
(
'${tableComment!}',
0,
'1',
'${functionName}',
'${moduleName}/${functionName}/index',
1,
0,
'C',
'0',
'0',
'${moduleName}:${functionName}:list',
'#',
'admin',
${dbTime},
'',
NULL,
'${tableComment!}菜单'
);

-- 父菜单ID
<#if dbType=="SQLServer">
DECLARE @menuId int
</#if>
set @menuId = @@identity;

-- 按钮
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${tableComment!}查询', (SELECT @menuId), '1',  '#', '', 1, 0, 'F', '0', '0', '${moduleName}:${functionName}:query',        '#', 'admin', ${dbTime}, '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${tableComment!}新增', (SELECT @menuId), '2',  '#', '', 1, 0, 'F', '0', '0', '${moduleName}:${functionName}:add',          '#', 'admin', ${dbTime}, '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${tableComment!}修改', (SELECT @menuId), '3',  '#', '', 1, 0, 'F', '0', '0', '${moduleName}:${functionName}:edit',         '#', 'admin', ${dbTime}, '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('${tableComment!}删除', (SELECT @menuId), '4',  '#', '', 1, 0, 'F', '0', '0', '${moduleName}:${functionName}:remove',       '#', 'admin', ${dbTime}, '', null, '');